@echo off

:: Batch file to build ToDoIt minified gadget xml.
:: Copy it and edit CONFIG (set paths) below:
:: Get Google's JS Minifier:  http://code.google.com/p/closure-compiler/
:: Get Yahoo!'s JS & CSS Compressor:  http://yuilibrary.com/downloads/#yuicompressor

:: CONFIG:
set JAVA_HOME=C:\path\to\java16\home
set JS_GOOGLEC=C:\file\path\to\google\compiler.jar
set JS_YUIC=C:\file\path\to\yahoo\yuicompressor-2.4.2.jar
:: //CONFIG


cd /d "%~dp0"

set PATH=%JAVA_HOME%\bin;%PATH%
set CLASSPATH=.;%JAVA_HOME%\lib


:: Google Compiler: minify .JS
java -jar "%JS_GOOGLEC%"  --js=..\jquery.color.js  --js=..\date.format.js  --js=..\pretty_date.js  --js=..\jquery.animateToClassEx.js  --js=..\jquery.hotkeys-0.7.9.min.js  --js=..\jquery.autocomplete.min.js  --js=..\date.js  --js=..\datepicker.js  --js=..\todoit_utils.js  --js=..\todoit_core.js  --js=..\tasks_gui.js  --js=..\tasks_edit.js  --js=..\ac_local.js  --js=..\cli.js  --js=..\todoit_main.js    --js_output_file=incls-out-GC.js


:: Yahoo! YUI Compressor: (Also for CSS)
::java -jar "%JS_YUIC%"  incls-out-GC.js    -o incls-out-GC-YUI.js


:: .CSS pass:
copy /b  ..\todoit_new_style.css + ..\jquery.autocomplete.css + ..\datepicker.css + ..\tasks_edit.css + ..\cli.css    all_styles_cat.css
java -jar "%JS_YUIC%"  all_styles_cat.css    --type css  -o all_styles_min.css
::del all_styles_cat.css


:: Build into extension .xml:
copy /b  tpl_todoit.xml_1.xml + incls-out-GC.js + tpl_todoit.xml_2.xml + all_styles_min.css + tpl_todoit.xml_3.xml    todoit_min.xml


:: Build packed js .xml too:
:: Note: "minified" is preferred on Wave (as it gets gzipped better, cached by Google, and loaded faster), and not "packed", so you may safely ignore this.
@if EXIST pack-js.bat call pack-js.bat
@if EXIST gzip-js.bat call gzip-js.bat


pause
